<%-- 
    Document   : conversionFrame
    Created on : 5 nov. 2010, 17:03:45
    Author     : boomar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
                    double montantOrigine;
                    double montantConverti;

                    try {
                        montantOrigine = Double.parseDouble(request.getParameter("montant"));

                        if (montantOrigine < 0) {
                            out.println("Valeur Négative !! ");
                            montantOrigine = 0;
                        }

                        //Récupération du sens de conversion
                        String sensConversion = request.getParameter("sensConversion");

                        //Conversion en fonction de du sens de conversion
                        montantConverti = sensConversion.equals("euToDo") ? montantOrigine * 1.41 : montantOrigine / 1.41;

                    } catch (Exception e) {
                        out.println("Format de donnée incompatible !! ");
                        montantOrigine = 0;
                        montantConverti = 0;
                    }
        %>

        <p> <b>Montant d'origine :</b> <%= montantOrigine%> </p>
        <p> <b>Montant converti :</b> <%= montantConverti%> </p>
    </body>
</html>
